package com.timeDeal.servlet;


import com.alibaba.druid.util.StringUtils;
import com.timeDeal.bean.JiaoyiQingqiuBean;
import com.timeDeal.service.AdminService;
import com.timeDeal.service.JiaoyiQingqiuServicce;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


/**
 * Created by Administrator on 2016/7/24.
 */

public class TongyiQIngqiuServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, IOException, IOException {
            String id = request.getParameter("id");
            String flag = request.getParameter("szl");
            String  currentpage = request.getParameter("currentpage");
            System.out.println(id);
            System.out.println(currentpage);
            System.out.println(flag);
            currentpage = StringUtils.equals(currentpage,null)?"1":currentpage ;
            JiaoyiQingqiuServicce jiaoyiQingqiuServicce = new JiaoyiQingqiuServicce();
            JiaoyiQingqiuBean  jiaoyiQingqiuBean = jiaoyiQingqiuServicce.getAQingqiuByid(Integer.valueOf(id));
            if(StringUtils.equals(flag,"t")){
                System.out.println("ggggggggggggggggg");
                System.out.println(jiaoyiQingqiuBean.getQingqiuduixiangid());
                jiaoyiQingqiuServicce.Tongyi(jiaoyiQingqiuBean) ;
            }
           else{
                 System.out.println("EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE");
                 System.out.println(jiaoyiQingqiuBean.getQingqiuduixiangid()+"EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE");
                 jiaoyiQingqiuServicce.buTongyi(jiaoyiQingqiuBean);
            }

          request.getRequestDispatcher("/user/jiaoyiqingqiugg.jsp?currentpage=" + currentpage).forward(request, response);

            }

}